package com.rk.kbk.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rk.kbk.common.DateJsonDeserializer;
import com.rk.kbk.common.DateJsonSerializer;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @OrderGoods
 * @订单详情(order_goods)
 * @version : Ver 1.0
 */
@Entity
public class OrderGoods implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * @备注:商城订单id
	 * @字段:id BIGINT(19)
	 */
	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	@GenericGenerator(name="auto-identity",strategy="identity")
	@Column(updatable = false, columnDefinition="BIGINT(19) COMMENT '商城订单id'")
	private java.lang.Long id;

	/**
	 * @备注:订单编号
	 * @字段:order_number VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '订单编号'")
	private java.lang.String orderNumber;

	/**
	 * @备注:商品id
	 * @字段:goods BIGINT(19)
	 */
	@ManyToOne
	@JoinColumn(name="goods", columnDefinition="BIGINT(19) COMMENT '商品id'")
	private Goods goods;

	/**
	 * @备注:商品价格id
	 * @字段:goods_unit BIGINT(19)
	 */
	@ManyToOne
	@JoinColumn(name="goodsUnit", columnDefinition="BIGINT(19) COMMENT '商品价格id'")
	private GoodsUnit goodsUn;

	/**
	 * @备注:购买数量
	 * @字段:nums INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '购买数量'")
	private java.lang.Integer nums;

	/**
	 * @备注:支付金额
	 * @字段:pay_money DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT '支付金额'")
	private java.lang.Double payMoney;

	/**
	 * @备注:支付方式,1表示余额支付，2表示微信支付，3表示支付宝支付
	 * @字段:pay_type VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '支付方式,1表示余额支付，2表示微信支付，3表示支付宝支付'")
	private java.lang.String payType;

	/**
	 * @备注:订单状态
	 * @字段:order_status VARCHAR(33)
	 */
	@Column(columnDefinition="INT(33) COMMENT '订单状态'")
	private java.lang.Integer orderStatus;

	/**
	 * @备注:校验码
	 * @字段:verify VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '校验码'")
	private java.lang.String verify;

	/**
	 * @备注:付款时间
	 * @字段:pay_time DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '付款时间'")
	private java.util.Date payTime;




	/**
	 * @备注:用户
	 * @字段:pay_time DATETIME(19)
	 */
	@ManyToOne
	@JoinColumn(name="user", columnDefinition="BIGINT(33) COMMENT '用户id'")
	private User user;

	/**
	 * @备注:完成时间
	 * @字段:comcate_time DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '完成时间'")
	private java.util.Date comcateTime;

	/**
	 * @备注:创建时间
	 * @字段:gmt_datetime DATETIME(19)
	 */
	@Column(updatable = false, columnDefinition="DATETIME(19) COMMENT '创建时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date gmtDatetime = new java.util.Date();

	/**
	 * @备注:修改时间
	 * @字段:upt_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '修改时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date uptDatetime = new java.util.Date();



	@Transient
	private Address address;


	public OrderGoods(){
	}

	public OrderGoods(
		java.lang.Long id
	){
		this.id = id;
	}


	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public void setId(java.lang.Long id) {
		this.id = id;
	}

	public java.lang.Long getId() {
		return this.id;
	}


	public void setOrderNumber(java.lang.String orderNumber) {
		this.orderNumber = orderNumber;
	}

	public java.lang.String getOrderNumber() {
		return this.orderNumber;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	public void setGoodsUn(GoodsUnit goodsUn) {
		this.goodsUn = goodsUn;
	}

	public GoodsUnit getGoodsUn() {
		return this.goodsUn;
	}


	public void setNums(java.lang.Integer nums) {
		this.nums = nums;
	}

	public java.lang.Integer getNums() {
		return this.nums;
	}


	public void setPayMoney(java.lang.Double payMoney) {
		this.payMoney = payMoney;
	}

	public java.lang.Double getPayMoney() {
		return this.payMoney;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public void setPayType(java.lang.String payType) {
		this.payType = payType;
	}

	public java.lang.String getPayType() {
		return this.payType;
	}

	public Integer getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(Integer orderStatus) {
		this.orderStatus = orderStatus;
	}

	public void setVerify(java.lang.String verify) {
		this.verify = verify;
	}

	public java.lang.String getVerify() {
		return this.verify;
	}


	public void setPayTime(java.util.Date payTime) {
		this.payTime = payTime;
	}

	public java.util.Date getPayTime() {
		return this.payTime;
	}


	public void setComcateTime(java.util.Date comcateTime) {
		this.comcateTime = comcateTime;
	}

	public java.util.Date getComcateTime() {
		return this.comcateTime;
	}


	public void setGmtDatetime(java.util.Date gmtDatetime) {
		this.gmtDatetime = gmtDatetime;
	}

	public java.util.Date getGmtDatetime() {
		return this.gmtDatetime;
	}


	public void setUptDatetime(java.util.Date uptDatetime) {
		this.uptDatetime = uptDatetime;
	}

	public java.util.Date getUptDatetime() {
		return this.uptDatetime;
	}
}
